﻿<UserControl x:Class="Snippet2Vsi.UserControls.Converter"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent"
             xmlns:ACB="clr-namespace:AttachedCommands.ACB;assembly=AttachedCommands">
    <UserControl.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="Margin" Value="5,0,0,0"/>
            <Setter Property="Foreground" Value="Navy"/>
        </Style>
        <Style  TargetType="{x:Type TextBox}">
            <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
            <Setter Property="AllowDrop" Value="true" />
            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
            <Setter Property="VerticalContentAlignment" Value="Stretch" />
            <Setter Property="FontFamily" Value="Segoe UI" />
            <Setter Property="FontSize" Value="12" />
            <Setter Property="Padding" Value="8,5,3,3" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="Height" Value="Auto"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TextBox}">
                        <Grid HorizontalAlignment="Stretch">
                            <Border x:Name="BorderBase" Background="White" BorderThickness="1.4,1.4,1,1" 
                            BorderBrush="Silver" CornerRadius="10" />
                            <Label x:Name="TextPrompt" Content="{TemplateBinding Tag}" Visibility="Collapsed" Focusable="False"  Foreground="Silver" Margin="5,4,0,0" ></Label>
                            <ScrollViewer Margin="0" x:Name="PART_ContentHost" Foreground="{DynamicResource OutsideFontColor}" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsFocused" Value="False"></Condition>
                                    <Condition Property="Text" Value=""></Condition>
                                </MultiTrigger.Conditions>
                                <MultiTrigger.Setters>
                                    <Setter Property="Visibility" TargetName="TextPrompt" Value="Visible"></Setter>
                                </MultiTrigger.Setters>
                            </MultiTrigger>
                            <Trigger Property="IsFocused" Value="True">
                                <Setter Property="BorderThickness" TargetName="BorderBase" Value="2.4,2.4,1,1"></Setter>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter Property="Foreground" Value="DimGray" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="28" />
            <RowDefinition Height="28" />
            <RowDefinition Height="15" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition/>
            <ColumnDefinition Width="30"/>
        </Grid.ColumnDefinitions>
        <!--Snippet-->
        <TextBlock Grid.Row="0" Grid.Column="0" Text="Snippet:"></TextBlock>
        <TextBox x:Name="txtSnippet"  Grid.Row="0" Grid.Column="1" Margin="5,0,5,0" Height="22" Background="#EAF3FB" Tag="Enter snippet location">
            <TextBox.ToolTip>
                <Fluent:ScreenTip Title="Snippet Location"  Image="../Images\snippet.ico"
                          Text="Location of snippet file to be converted." />
            </TextBox.ToolTip>
        </TextBox>
        <Button    Grid.Row="0" Grid.Column="2" Content="..." Height="22" Width="22"
                   ACB:CommandBehavior.RoutedEventName="Click"
                   ACB:CommandBehavior.TheCommandToRun="{Binding BrowseSnippetCommand}">
            <Button.ToolTip>
                <Fluent:ScreenTip Title="Snippet Location"  Image="../Images\Browse.png"
                          Text="Browse to snippet location." />
            </Button.ToolTip>
        </Button>
        <!--Vsi-->
        <TextBlock Grid.Row="1" Grid.Column="0" Text="Vsi:"></TextBlock>
        <TextBox x:Name="txtVsi"  Grid.Row="1" Grid.Column="1" Margin="5,0,5,0" Height="22" Background="#EAF3FB" Tag="Enter vsi location">
            <TextBox.ToolTip>
                <Fluent:ScreenTip Title="Vsi Location"  Image="../Images\vsi.ico"
                          Text="Location of vsi file to be saved." />
            </TextBox.ToolTip>
        </TextBox>
        <Button    Grid.Row="1" Grid.Column="2" Content="..." Height="22" Width="22"
                   ACB:CommandBehavior.RoutedEventName="Click"
                   ACB:CommandBehavior.TheCommandToRun="{Binding BrowseVsiCommand}">
            <Button.ToolTip>
                <Fluent:ScreenTip Title="Vsi Location"  Image="../Images\Browse.png"
                          Text="Location of vsi file to be saved." />
            </Button.ToolTip>
        </Button>
      
        <!--Convert-->
        <Button Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" Height="24" HorizontalAlignment="Center" Width="100" 
                ACB:CommandBehavior.RoutedEventName="Click"
                ACB:CommandBehavior.TheCommandToRun="{Binding ConvertCommand}">
            <Button.ToolTip>
                <Fluent:ScreenTip Title="Convert Snippet To Vsi"  Image="../Images\Converter-32.png"
                          Text="Convert snippet file to vsi file." />
            </Button.ToolTip>
            <StackPanel Orientation="Horizontal">
                <Image Source="../Images/Converter-32.png"></Image>
                <TextBlock>Convert</TextBlock>
            </StackPanel>
        </Button>
    </Grid>
</UserControl>
